import java.math.BigInteger;
import java.util.LinkedList;




public class FermatsFactor {
	private static Kattio io;
	
	private static final int PRIME_SENS = 10;
	
	/** Start time for this execution. */
    private static long startTime;

    /** Current "time". */
    private static long time;

    /** Time limit for this run (all numbers). */
    private static final long TIME_LIMIT = (long) (14.5 * Math.pow(10, 9));
    
    private static LinkedList<String> factors = new LinkedList<String>();
	
	static boolean Factor(BigInteger n,boolean firstInput){
		if (n.compareTo(BigInteger.ONE) == 0){
			return false;
		}
		if(n % 2 == 0){
			factors.add("2");
			Factor(n/2,false);
			return true;
		}
		
		double a = Math.ceil(Math.sqrt(n));
		double b2 = a*a- n;
		
		double b2sqrt = Math.sqrt(b2);
		while (b2sqrt != Math.ceil(b2sqrt)){
			a = a+1;
			b2 = a * a -n;
			b2sqrt = Math.sqrt(b2);
		}
		int factor = (int) (a - Math.sqrt(b2));
		if(factor == 1){
			if(!firstInput){
				factors.add(n.toString());
				return true;
			}
			return false;
		}
		Factor(factor,false);
		Factor(n/factor,false);
		return true;
	}
	
	public static void main(String[] args){
		
	}
	
	public void failRest() {
        while(io.hasMoreTokens()) {
                io.println("fail");
                io.println();
                io.getWord();
        }
}
	
}